{% extends "layout.html" %}
{% block body %}
<div class="amz-banner">
    <div class="am-scrollspy-init am-scrollspy-inview " style="padding-top:36px;padding-bottom:36px;color:white;background-color:#00BFFF">
  <div class="am-container" style="margin: 0 auto; text-align: center">
      <img src="{{url_for('static',filename='./img/syzoj-logo.png')}}" style="height:125px">
      <h1 style="margin-top:5px;margin-bottom:6px;font-size:30px;font-weight:360">评测记录</h1>
      <ruby style="font-size:10px">纸上得来终觉浅<rt>Have fun Okay~</rt>,绝知此事要躬行</ruby>
</div>
    </div>
        </div>
    </div>
</div>
    <br>
<div class="am-container am-g">
    <form class="am-form-inline am-u-sm-8 " role="form" method="get" action="{{url_for('judge_state')}}">
        <div class="am-form-group am-fl">
            <input type="text" class="am-form-field am-input-sm" name="submitter" placeholder="提交者" value="{% if submitter %}{{submitter}}{% endif %}">
        </div>
        <div class="am-form-group am-fl">
            <input type="text" class="am-form-field am-input-sm" name="problem_id" placeholder="题目编号", value="{% if problem_id %}{{problem_id}}{% endif %}">
        </div>
        <button type="submit" class="am-btn am-btn-primary am-input-sm am-fl">搜索</button>
    </form>
    <div class="am-u-sm-4">
        <a class="am-btn am-btn-success am-input-sm am-fr" href="{{url_for('judge_state')}}?{{encode({'submitter':user.nickname})}}">我的提交</a>
    </div>
    <div class="am-u-sm-12">
        <table class="am-table">
            <thead>
            <tr>
                <th><center>编号</center></th>
                <th><center>题目名称</center></th>
                <th><center>状态</center></th>
                <th><center>分数</center></th>
                <th><center>总时间</center></th>
                <th><center>提交者</center></th>
                <th><center>提交时间</center></th>
            </tr>
            </thead>
            <tbody>
            {% for judge in judges %}
                {% set see_result=judge.is_allowed_see_result(user) %}
                {% set result=judge.get_result()%}
                <tr>
                    <td><center>{{judge.id}}</center></td>
                    <td><center><a href="{{url_for('problem',problem_id=judge.problem.id)}}">{{judge.problem.title}}</a></center></td>
                    {% if see_result %}
                    
                    <td><center>{{judge.status}}</center></td>

                    {% if judge.is_allowed_see_code(user) %}
                    <td><center><a href="{{url_for('judge_detail',judge_id=judge.id)}}">{{result["score"]}}</a></center></td>
                    {% else %}
                    <td><center>{{result["score"]}}</center></td>
                    {% endif %}

                    <td><center>{{result["total_time"]}}</center></td>
                    {% else %}
                    <td><center>隐藏</center></td>
                    <td><center>隐藏</center></td>
                    <td><center>隐藏</center></td>
                    {% endif %}
                    <td><center><a href="{{url_for('user',user_id=judge.user.id)}}">{{judge.user.nickname}}</a></center></td>
                    <td><center>{{tool.pretty_time(judge.submit_time)}}</center></td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
    <hr />
    {{sorter.get_html()|safe}}
</div>
{% endblock %}
